package com.ff.xyh.api.minio.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther FF
 * @Date 2022年 10月 24日
 * @Time 13:02
 */

@Configuration
public class MinioClientConfiguration {
    @Value("${minio.endpoint}")
    private String endPoint;
    @Value("${minio.port}")
    private Integer port;
    @Value("${minio.secure}")
    private Boolean secure;
    @Value("${minio.accesskey}")
    private String accessKey;
    @Value("${minio.secretkey}")
    private String secretKey;

    @Bean
    public MinioClient minioClient(){
        return MinioClient.builder()
                .endpoint(endPoint, port, secure)
                .credentials(accessKey, secretKey)
                .build();
    }

}
